package bridge

import "fmt"

// 支付操作实现器接口
type PaymentImplementer interface {
	ProcessPayment(amount float64) string
}

// 具体支付：微信支付
type WechatPay struct {
}

func (r *WechatPay) ProcessPayment(amount float64) string {
	return fmt.Sprintf("微信支付成功，金额：%.2f 元", amount)
}

// 具体支付：支付宝支付
type Alipay struct {
}

func (r *Alipay) ProcessPayment(amount float64) string {
	return fmt.Sprintf("支付宝支付成功，金额：%.2f 元", amount)
}

// 支付场景
type PaymentScenario interface {
	ExecutePayment(amount float64) string
	SetPaymentImplementer(implementer PaymentImplementer)
}

// 国内支付
type DomesticPayment struct {
	implementer PaymentImplementer
}

func (r *DomesticPayment) SetPaymentImplementer(implementer PaymentImplementer) {
	r.implementer = implementer
}
func (r *DomesticPayment) ExecutePayment(amount float64) string {
	result := r.implementer.ProcessPayment(amount)
	return "[国内支付]" + result + "（已处理货币转换）"
}

// 跨境支付
type CrossBorderPayment struct {
	implementer PaymentImplementer
}

func (r *CrossBorderPayment) SetPaymentImplementer(implementer PaymentImplementer) {
	r.implementer = implementer
}
func (r *CrossBorderPayment) ExecutePayment(amount float64) string {
	result := r.implementer.ProcessPayment(amount)
	return "[跨境支付]" + result + "（已处理外汇结算）"
}
